<template>
	<view>
		<!-- 订单列表 -->
		<view class="ddlb">
			<view style="background-color: #fff;margin-top: 10px;">
				<view class="dd-dd">
					<p>运费：{{all_advance_amount}}</p>
					<p>保证金：{{bond_amount || ''}}</p>
					<p>应垫资金额：{{all_delivery_amount}}</p>
					<p>合计：{{all_freight_amount}}</p>
				</view>
			</view>

			<view class="dd" v-for="(time,index) in order_lists_Data.data.data">
				<view class="dd-top">
					<view class="dd-q">
						订单编号 ：{{time.tms_order_sn || ''}}
					</view>
					<view class="dd-p" :style="
					time.status==1?'color:#1890FF;':
					time.status==2?'color:#CF9200;':
					time.status==3?'color:#CF9200;':
					time.status==4?'color:#0ACF00;':''
					">

						{{
							time.status==1?'待发车':
							time.status==2?'运输中':
							time.status==3?'待配送':
							time.status==4?'已送达':''
						}}
					</view>
				</view>

				<view class="dd-dd" @click="tzxx(time.id)">
					<!-- 是否垫资 0 未垫资 1=垫资 -->
					<p>是否垫付：{{time.is_advance==0?"否":"是"}}</p>
					<p>吨数：{{time.all_weight}}吨</p>
					<!-- 是否需要配送 0不需要 1=需要 -->
					<p>是否送货：{{time.is_delivery==0?"否":"是"}}</p>
				</view>

			</view>

			<button v-if="amount_status==0||amount_status==3" @click="scqf()">申请车费</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				order_lists_Data: [],
				all_advance_amount: "",
				all_amount: "",
				all_delivery_amount: "",
				all_freight_amount: "",
				amount_status: "",
				bond_amount: "",
				id: ""
			}
		},
		onLoad(open) {
			console.log("open:", open);
			this.all_advance_amount = open.freight;
			this.all_amount = open.all_amount;
			this.all_delivery_amount = open.should_advance_amount;
			this.all_freight_amount = open.all_freight_amount;
			this.amount_status = open.amount_status;
			this.bond_amount = open.bond_amount;
			this.id = open.id;
			this.order_lists(open.id);
		},
		methods: {
			// 申请车费选择
			scqf() {
				uni.navigateTo({
					url: "/pages/my/a_xuanzezhanghu?id=" + this.id + "&bond_amount=" + this.all_freight_amount +
						"&name=chefei"
				});
			},
			tzxx(x) {
				uni.navigateTo({
					url: "/pages/shenqingchefei/shenqingchefei_b?id=" + x
				});
			},

			//申请车费
			Freight_apply(bank_id) {
				let data = {
					waybill_id: this.id,
					bank_id: bank_id
				}
				this.$rqt.Freight_apply(data).then(res => {
					console.log(res);
					uni.showToast({
						title: res.msg,
						icon: "success",
						duration: 850
					});
					this.order_lists(this.id);
				})
			},
			//订单列表
			order_lists(id) {
				let data = {
					waybill_id: id
				}
				this.$rqt.order_lists(data).then(res => {
					console.log(res);
					this.order_lists_Data = res;
				})
			}
		}
	}
</script>

<style scoped>
	/* 订单列表 */
	.ddlb {
		padding-bottom: 20px;
		width: 100%;
		margin: 0 auto;
	}

	.ddlb>button {
		margin-top: 20px;
		width: 95%;
		height: 50px;
		box-shadow: 0px 0px 4px 0px rgba(204, 204, 204, 0.5);
		color: #fff;
		background: #1890FF;
	}

	.dd {
		margin-top: 12px;
		width: 100%;
		padding-bottom: 10px;
		background: #FFFFFF;
		box-shadow: 0px 0px 6px 0px rgba(204, 204, 204, 0.5);
	}

	.dd-top {
		width: 100%;
		display: flex;
		justify-content: space-between;
		border-bottom: 1px dashed #CCCCCC;
	}

	.dd-q {
		font-size: 18px;
		font-weight: 500;
		margin-left: 20px;
		line-height: 50px;
	}

	.dd-p {
		font-size: 18px;
		line-height: 50px;
		margin-right: 20px;
		color: #0ACF00;
		font-weight: 600;
	}

	.dd-dd {
		overflow: hidden;
		width: 90%;
		margin: 0 auto;
	}

	.dd-dd>p {
		line-height: 40px;
		float: left;
		width: 50%;
		font-size: 16px;
		font-weight: 400;
	}
</style>
<style>
	page {
		background: #F7F7F7;
	}
</style>